﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model.Enum;
using Model.Other;
using Shop.Interface.Files;
using Shop.WebApi.Config;

namespace Shop.WebApi.Controllers
{
    public class FileController : BaseController
    {
        private IFileService _fileService;

        public FileController(IFileService fileService)
        {
            _fileService = fileService;
        }
        /// <summary>
        /// 上传文件
        /// </summary>
        /// <param name="files"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult> UploadFile(List<IFormFile> files,UploadMode mode)
        {
            return ResultHelper.Success(await _fileService.Upload(files,mode));
        }
    }
}
